@extends('layouts.default') @section('main')
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <link rel="stylesheet" href="/css/chosen.css" />
    <script type="text/javascript" src="{{URL::asset('js/')}}/ajaxfileupload.js"></script>
    <script type="text/javascript" src="/js/chosen.jquery.min.js"></script>
    <script type="text/javascript" src="{{URL::asset('js/')}}/common.js"></script>
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
                            class="icon-home"></i> 首页</a>
                <a href="{{url('smstemplate/index')}}" class="tip-bottom">短信模板管理</a>
                <a href="#" class="current">编辑短信模板</a>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span9">
                    <div class="widget-box">
                        <div class="widget-title">
						<span class="icon"> <i class="icon-align-justify"></i>
						</span>
                            <h5>编辑短信模板</h5>
                        </div>
                        <div class="widget-content nopadding">
                            <form action="{{url('smstemplate/edit')}}" method="post" id="adForm" class="form-horizontal">

                                <div class="control-group">
                                    <label class="control-label">标题 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="id" value="{{$list->id}}" readonly />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>标题 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="subject" value="{{$list->subject}}" placeholder="标题" />
                                    </div>
                                </div>

                                <div class="control-group" >
                                    <label class="control-label"><span class="redD">*</span>内容 :</label>
                                    <div class="controls">
                                        <textarea name="content" placeholder='如果该模板关联项目，则用"::project"表示，如果关联到活动，则用"::activity"表示，以上标点符号均为英文状态下的，否则无法生效' style="width:610px; height:100px">{{$list->content}}</textarea>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>是否关联活动 :</label>
                                    <div class="controls">
                                        <select  name="related_activity" class="span11" >
                                            <option value="">是否关联活动</option>
                                            <option value="1" @if($list->related_activity==1) selected @endif >是</option>
                                            <option value="0" @if($list->related_activity==0) selected @endif  >否</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>是否关联项目 :</label>
                                    <div class="controls">
                                        <select  name="related_project" class="span11" >
                                            <option value="">是否关联项目</option>
                                            <option value="1" @if($list->related_project==1) selected @endif >是</option>
                                            <option value="0" @if($list->related_project==0) selected @endif >否</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>排序 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="sort" value="{{$list->sort}}" placeholder="sort" value="50" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>状态 :</label>
                                    <div class="controls">
                                        <select  name="status" class="span11" >
                                            <option value="">请选择</option>
                                            <option value="1" @if($list->status==1) selected @endif >启用</option>
                                            <option value="0" @if($list->status==0) selected @endif >禁用</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="form-actions">
                                    <input type="hidden" class="span11" name="formType" id="formType" value="create"  />
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    <button type="button" id="doSave" class="btn btn-success">保存</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>

        $("#doSave").click(function(){
            ajaxRequest($('#adForm').serializeArray(),$('#adForm').attr('action'),function(data){
                if(data.status){
                    alert(data.message);
                    window.location.href = data.forwardUrl;
                }else{
                    alert(data.message);
                }
            });
        });
    </script>
@stop
